package SFT;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**OutputClass.java
 * The output of our central function is an object of this type. It simply contains
 * a list of TimeElements. See "TimeElement" for further explanations...
 * @author Baruch Weizman, Oren Gilon, Barak Arkis*/
public class OutputClass implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public OutputClass(){
		this.frameList=new ArrayList<TimeElements>();
		this.secondsList=new ArrayList<TimeElements>();
	}
	
	private List<TimeElements> frameList;
	
	private List<TimeElements> secondsList;

	/**to be used when an OutputClass object is to be exported to a WAV file. this is the sampleRate of the file
	 * that needs to be created, i.e. this is the sample rate of the WAV file that this object was created from.*/
	private long sampleRate;

	/**returns the secondsList,  where the unit of the frequencies is "number of cycles per second", or hertz*/
	public List<TimeElements> getSecondsList() {
		return secondsList;
	}
	
	/**	returns the frameList, where the unit of the frequencies is "number of cycles per frame"*/
	public List<TimeElements> getFrameList() {
		return frameList;
	}

	/**prints out the structure of Output*/
	public void print() {
		System.out.print("*** Start of Output ");
		for (TimeElements tm : secondsList) {
			System.out.println("***");
			tm.print();
		}
		System.out.println("*** End of Output ***");
		
	}
	
	/**deduces from the frameList the secondList, i.e. it changes the units in the list, as described
	 * in the definition of getSecondsList() and getFrameList()*/
	public void fillSeconds() {
		for (TimeElements tm : frameList) {
			secondsList.add(TimeElements.copyTM(tm, this.sampleRate));
		}
		
	}

	/**getter and setter for sampleRate*/
	public long getSampleRate() {
		return this.sampleRate;
	}
	public void setSampleRate(long samp) {
		this.sampleRate=samp;
	}

}
